package cn.kickegg.concurrent.atomic;


import cn.kickegg.concurrent.TljucUtil;

import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;

public class Atomic05Example {

    public static final AtomicIntegerFieldUpdater<Wukong> atomicInteger= AtomicIntegerFieldUpdater.newUpdater(Wukong.class,"score");


    public static void main(String[] args) {
        final Wukong wukong=new Wukong();
        final Atomic05Example atomic04Example=new Atomic05Example();
        TljucUtil.timeTasks(100, 1, new Runnable() {
            @Override
            public void run() {
                atomicInteger.incrementAndGet(wukong);
            }
        });
        System.out.println("score:"+wukong.score);
    }


}
class Wukong
{

    volatile int score;//统计


}